--处理跨域问题脚本

--伪装服务器
ngx.header.Server = "IIS"

ngx.header.Connection="close"

--跨域设置
ngx.header["Access-Control-Allow-Origin"] ="*"
ngx.header["Access-Control-Allow-Credentials"] ="true"
--ngx.header["Access-Control-Allow-Headers"] ="access-control-allow-origin,authority,version-info, DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range, userid, agent, brandid, language, token"
--ngx.header["Access-Control-Allow-Headers"] ="*"
ngx.header["Access-Control-Allow-Headers"] ="X-HTTP-Method-Override,Content-Type,X-Forwarded-For,X-Access-Token,Access-Control-Allow-Origin,withCredentials,crossDomain"


if ngx.var.request_method =="OPTIONS"then

     ngx.header["Access-Control-Max-Age"] ="1728000"

     ngx.header["Access-Control-Allow-Methods"] ="GET, POST, OPTIONS, PUT,HEAD, DELETE,REQUIRE"

     ngx.header["Content-Length"] ="0"

     ngx.header["Content-Type"] ="application/json; charset=utf-8"
end

